package org.objective.dal.commands;

import java.util.UUID;
import org.common.service.ServiceRegister;
import org.objective.command.AuthToken;
import org.objective.command.Command;
import org.objective.command.CommandResult;

import org.objective.service.DalService;
import static org.utils.fp.collection.CollectionFactory.*;

/**
 *
 * @author gus
 */
public class CheckExistTypeCommand implements Command<Boolean>
{
    private static final long serialVersionUID = 7581836695510882379L;
    private final UUID oid;

    public CheckExistTypeCommand(UUID oid)
    {
        this.oid = oid;
    }

    @Override
    public Object[] getParameters()
    {
        return array(oid);
    }

    @Override
    public CommandResult<Boolean> execute(ServiceRegister provider, AuthToken token) throws Exception
    {
        DalService service = provider.getService(DalService.class);
        return service.checkExistType(oid);
    }
}
